﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BusinessObjects.BO_GetObjects;
using LibraryO2S;
using BusinessObjects;

public partial class controls_admin_FormContact : Pages_Base
{
    protected void Page_Load(object sender, EventArgs e)
    {
        base.removeHGC(divMessage);
        if (!IsPostBack)
            loadContact();
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            base.OpenConnection();
            string content = txtContent.Value;
            string contentEng = txtContentEng.Value;
            //BO_Articles.Update(17, "57", "", "", "", "", "", "", "", "", "", "",
            //    content, contentEng, "", "", 1, 1, false, 1,
            //    DateTime.Now, "tindd", DateTime.Now, "tindd", true);
            txtContent.Value = "";
            txtContentEng.Value = "";
            divMessage.InnerHtml = O2S_Message.Success("Thông Báo", "Thao tác thành công");
        }
        catch (Exception ex)
        {
            divMessage.InnerHtml = O2S_Message.Error("Lỗi", "Phát hiện lỗi :<br />" + ex.Message);
        }
        finally { base.CloseConnection(); }
    }
    private void loadContact()
    {
        try
        {
            base.OpenConnection();
            DataTable objDT = BO_Articles.Search(17);
            if (objDT.Rows.Count > 0)
            {
                txtContent.Value = objDT.Rows[0]["NEWS_DETAIL"].ToString();
                txtContentEng.Value = objDT.Rows[0]["NEWS_DETAIL_ENG"].ToString();
            }
        }
        catch (Exception ex)
        {
            divMessage.InnerHtml = O2S_Message.Error("Lỗi", "Phát hiện lỗi :<br />" + ex.Message);
        }
        finally { base.CloseConnection(); }
    }
}
